00001
00015 #ifndef _XPOPUPMENUITEM_H_
00016 #define _XPOPUPMENUITEM_H_
00017
00018 #include "../defines.h"
00019
00020 #define XPMI_HEIGHT 22
00021 #define XPMI_BOXLPAD 0
00022 #define XPMI_BOXWIDTH 22
00023 #define XPMI_BOXRPAD 5
00024 #define XPMI_ICONSIZE 16
00025
00026
00027 class XPopupMenu;
00028 typedef struct tagXPMENUCOLORS XPMENUCOLORS, * LPXPMENUCOLORS;
00029
00036 class XPopupMenuItem {
00037
00038 public:
00039
00040 XPopupMenuItem( XPopupMenu * Parent, BOOL bSep );
00041 XPopupMenuItem( XPopupMenu * Parent, TString tsItemText, int nIcon, BOOL bSubMenu );
00042 virtual ~XPopupMenuItem( );
00043
00044 void DrawItem( LPDRAWITEMSTRUCT lpdis );
00045 void DrawItemBackground( LPDRAWITEMSTRUCT lpdis, LPXPMENUCOLORS lpcol );
00046 void DrawItemBox( LPDRAWITEMSTRUCT lpdis, LPXPMENUCOLORS lpcol );
00047 void DrawItemSelection( LPDRAWITEMSTRUCT lpdis, LPXPMENUCOLORS lpcol, BOOL bDis = FALSE );
00048 void DrawItemCheckBox( LPDRAWITEMSTRUCT lpdis, LPXPMENUCOLORS lpcol, BOOL bDis = FALSE );
00049 void DrawItemText( LPDRAWITEMSTRUCT lpdis, LPXPMENUCOLORS lpcol, BOOL bDis = FALSE );
00050 void DrawItemIcon( LPDRAWITEMSTRUCT lpdis, LPXPMENUCOLORS lpcol, UINT iExStyles, BOOL bSel = FALSE, BOOL bDis = FALSE );
00051 void DrawItemSubArrow( LPDRAWITEMSTRUCT lpdis, LPXPMENUCOLORS lpcol, BOOL bDis = FALSE );
00052 void DrawItemSeparator( LPDRAWITEMSTRUCT lpdis, LPXPMENUCOLORS lpcol );
00053
00054 SIZE getItemSize( HWND mHwnd );
00055
00056 void executeCommand( );
00057
00058 static void DrawGradient( HDC hdc, LPRECT lprc, COLORREF clrStart, COLORREF clrEnd, BOOL bHorz = FALSE );
00059 static COLORREF LightenColor( unsigned int iScale, COLORREF clrColor );
00060 static COLORREF DarkenColor( unsigned int iScale, COLORREF clrColor );
00061
00062 void setSubMenu( BOOL bSubMenu );
00063 void setItemText( TString & tsItemText );
00064 void setItemIcon( int nIcon );
00065 TString * getItemText( );
00066 int getItemIcon( );
00067
00068 protected:
00069
00070 BOOL m_bSep;
00071 BOOL m_bSubMenu;
00072 TString m_tsItemText;
00073 TString m_tsItemCommand;
00074 int m_nIcon;
00075 XPopupMenu * m_pXParentMenu;
00076
00077 };
00078
00079 typedef std::vector<XPopupMenuItem *> VectorOfXPopupMenuItem;
00080
00081 #endif // _XPOPUPMENUITEM_H_